package com.xjtu.platform.user.admin.time_set.dao;

import com.xjtu.platform.user.admin.time_set.RecordModel;
import com.xjtu.platform.user.admin.time_set.TimeSetDto;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TimeSetDao {



    @Select("select count(*) from time" )
    int countTime();

    @Insert("insert into time(time_id,start_time,end_time) value(#{time_id},#{start_time},#{end_time})")
    void timeAdd(TimeSetDto dto);

    @Select("select * from time")
     List<RecordModel> getInfo(TimeSetDto dto);

    @Delete("delete from time")
    void clearTime();

    @Update("update time set start_time = #{start_time} , end_time = #{end_time} where time_id = #{time_id}")
    void changeTime(TimeSetDto dto);

    @Select("select count(*) from time where end_time > #{start_time} and start_time < #{end_time} and time_id!=#{time_id}")
    int checkTime(TimeSetDto dto);


}
